<template>
  <div class="menu-box container fix">
    <div class="menu">
      <my-menu :menuData="menuData"></my-menu>
    </div>
    <div class="menu-content">
      <router-view></router-view>
    </div>
  </div>
</template>
<script type="text/javascript">
import MyMenu from '../components/Menu'
import { mapState } from 'vuex'
export default {
  components: {
    MyMenu
  },
  data() {
    return {
      menuData: [],
      dic: {
        '数据中心': {
          url: '/index/data-center'
        },
        '平台交易记录': {
          url: '/index/trading-record'
        },
        '交易监控套餐': {
          url: '/index/transaction-package-list',
          children: {
            '交易监控套餐列表': '/index/transaction-package-list',
            '新增交易监控套餐': '/index/transaction-new-package'
          }
        },
        '企业资质审核': {
          url: '/index/company-aptitude-audit'
        },
        '注册律所管理': {
          url: '/index/law-firm-audit',
          children: {
            '律所审核': '/index/law-firm-audit',
            '律所年检': '/index/law-firm-inspect'
          }
        },
        '信息中心': {
          url: '/index/message-center'
        },
        '业务管理部': {
          url: '/index/transaction-order-manage',
          children: {
            '交易监控订单管理': '/index/transaction-order-manage',
            '交易监控服务通知': '/index/transaction-notice',
            '合同审查表管理': '/index/contract-review',
            '法律服务订单管理': '/index/law-order-manage',
            '法律服务通知': '/index/law-notice'
          }
        },
        '首席监控师': {
          url: '/index/cm-transaction-list',
          children: {
            '交易监控订单管理': '/index/cm-transaction-list',
            '交易监控订单分配记录': '/index/cm-transaction-reallocate',
            '法律服务订单管理': '/index/cm-law-list',
            '法律服务订单分配记录': '/index/cm-law-reallocate',
            '处理纠错': '/index/cm-error-list'
          }
        },
        '交易监控师': {
          url: '/index/tm-order-list',
          children: {
            '订单管理': '/index/tm-order-list',
            '客户纠错记录': '/index/tm-error-list'
          }
        },
        '交易监控员': {
          url: '/index/tms-order-list',
          children: {
            '订单管理': '/index/tms-order-list',
            '闹钟设置记录': '/index/tms-alarm-list',
            '纠错申请记录': '/index/tms-error-list',
            '消息管理': '/index/tms-message-manage'
          }
        },
        '法律服务监控员': {
          url: '/index/lms-order-list',
          children: {
            '订单管理': '/index/lms-order-list',
            '客户投诉列表': '/index/lms-complaint-list',
            '消息管理': '/index/lms-message-manage'
          }
        },
        '服务评价管理': {
          url: '/index/transaction-evaluate',
          children: {
            '交易监控服务评价': '/index/transaction-evaluate',
            '法律服务评价': '/index/law-evaluate',
            '律师评价': '/index/lawyer-evaluate'
          }
        },
        '内容管理': {
          url: '/index/news-content',
          children: {
            '新闻资讯': '/index/news-content',
            '网站公告': '/index/website-notice',
            '帮助中心': '/index/help-center'
          }
        },
        '权限分配': {
          url: '/index/role-manage',
          children: {
            '角色管理': '/index/role-manage',
            '用户管理': '/index/user-manage'
          }
        }
      }
    }
  },
  computed: {
    ...mapState({
      menusData: (s) => {
        return s.menusData
      }
    })
  },
  created() {
    let arr = []
    this.menusData.forEach((item, index) => {
      arr[index] = {}
      arr[index].children = []
      arr[index].name = item.name
      arr[index].url = item.request
      arr[index].id = item.id
      if (item.children.length) {
        item.children.forEach((items, indexs) => {
          arr[index].children[indexs] = {}
          arr[index].children[indexs].name = items.name
          arr[index].children[indexs].url = items.request
        })
      }
    })
    this.menuData = arr
  }
}

</script>
<style type="text/css" scoped></style>
